home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8129 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: megatek.megatek.com!not-for-mail
  2. From: tpd@kelly.megatek.com (Tim Dietz)
  3. Newsgroups: comp.lang.c++,comp.unix.questions
  4. Subject: C++, Unix and Bus Errors
  5. Date: 14 Feb 1996 16:43:06 -0800
  6. Organization: Megatek Corporation, San Diego, California
  7. Distribution: usa
  8. Message-ID: <4ftviq$3op@kelly.megatek.com>
  9. NNTP-Posting-Host: kelly.megatek.com
  10.  
  11.  
  12.     Hi,
  13.  
  14.     My department is migrating from C to C++.  I'm
  15.     having problems trying to cleanly handle a bus
  16.     error.  With C, we just used setjmp()/longjmp()
  17.     and everything worked just fine.  However, in
  18.     C++, the longjmp doesn't return to where the
  19.     setjmp() was called.  So, I tried to wrap the
  20.     whole thing in a try-catch handler, with the
  21.     throw being in a regular function that acts
  22.     as the signal handler.  The first time I get
  23.     a bus error, things are handled just fine.  The
  24.     throw comes back to the corresponding catch and
  25.     things are cool.  However, the second and subsequent
  26.     times that a bus error occurs, it is as if the
  27.     signal handler was ignored.
  28.  
  29.     I tried to re-nominate the signal handler in the
  30.     catch block, but that didn't work.
  31.  
  32.     Anybody have any ideas on how to get this to work?
  33.  
  34.     BTW, I also want to do a similar thing to handle
  35.     segv, control-c, and alarms.
  36.  
  37.  
  38.     Thanks,
  39.  
  40.     Tim
  41.  
  42. -- 
  43. Tim Dietz
  44. tpd@megatek.com
  45.